﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using Storm.TabControl;
using Storm.TabControl.Base;
using Storm.TabControl.Design;
using Storm.TabControl.Helpers;

namespace TabControlTest
{
    public partial class Form1 : Form
    {
        private ToolStripDropDownMenu dropDown = new ToolStripDropDownMenu();

        public Form1()
        {
            InitializeComponent();
            TabToolStripMenuItem[] item = new TabToolStripMenuItem[1000];

            item[0] = new TabToolStripMenuItem(tabStrip);
            item[0].Text = "Close";
            item[0].Name = "btnClose";
            item[0].Visible = true;

            item[1] = new TabToolStripMenuItem(tabStrip);
            item[1].Text = "Close All But This";
            item[1].Name = "btnCloseABT";
            item[1].Visible = true;

            item[2] = new TabToolStripMenuItem(tabStrip);
            item[2].Text = "Close All";
            item[2].Name = "btnCloseAll";
            item[2].Visible = true;

            // Setup default actions
            item[0].UseDefaultAction = true;
            item[1].UseDefaultAction = true;
            item[2].UseDefaultAction = true;

            item[0].DefaultAction = TabDefaultAction.Close;
            item[1].DefaultAction = TabDefaultAction.CloseAllButThis;
            item[2].DefaultAction = TabDefaultAction.CloseAll;

            dropDown.Items.Add(item[0]);
            dropDown.Items.Add(item[1]);
            dropDown.Items.Add(item[2]);
            dropDown.DropShadowEnabled = true;

            tabStrip.RightClickMenu = dropDown;
            tabStrip.RightToLeft = RightToLeft.No;
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
			TabStripItem item = new TabStripItem("Caption " +
			Convert.ToString(tabStrip.Items.Count + 1), null);

			item.Controls.Add(new Button());

            tabStrip.AddTab(item, true);
        }

        private void btnRemove_Click(object sender, EventArgs e)
        {
            tabStrip.RemoveTab(tabStrip.SelectedItem);
        }
    }
}
